var _mm = require('util/mm.js');

var _address = {
  // 获取购物车数量
  getAddressList: function(resolve, reject) {
    _mm.request({
      url: _mm.getServerUrl('/shipping/list.do'),
      data: {
        pageSize: 50
      },
      success: resolve,
      error: reject

    })
  },
  // 添加地址
  addAddress: function(addressInfo, resolve, reject) {
    _mm.request({
      url: _mm.getServerUrl('/shipping/add.do'),
      data: addressInfo,

      success: resolve,
      error: reject
    })
  },
  // 更新地址
  updateAddress: function(addressInfo, resolve, reject) {
    _mm.request({
      url: _mm.getServerUrl('/shipping/update.do'),
      data: addressInfo,
      success: resolve,
      error: reject
    })
  },
  // 获取具体地址信息
  getAddress: function(shippingId, resolve, reject) {
    _mm.request({
      url: _mm.getServerUrl('/shipping/select.do'),
      data: {
        shippingId: shippingId
      },
      success: resolve,
      error: reject
    })
  },
  // 地址删除
  delAddress: function(shippingId, resolve, reject) {
    _mm.request({
      url: _mm.getServerUrl('/shipping/del.do'),
      data: {
        shippingId: shippingId
      },
      success: resolve,
      error: reject
    })
  }

};
module.exports = _address;